<?php

class DefaultController extends Controller
{    
    private function filterNurse() {
        $user = Yii::app()->getModule('user')->user();
        if(!$user || $user->profile->userType != 1) {
            throw new CHttpException(403, "You're not a nurse");
        } 
    }
    
	public function actionIndex()
	{
	    $this->filterNurse();
	    
	    $doctors = Profile::getDoctorIdNameByClinicArray(Yii::app()->getModule('user')->user()->clinicId);
	    
		$this->render('index', array(
	        'doctors' => $doctors,
        ));
	}
}